
Rem
	Converts a string to an array.
	
	@author	Nicholas Grant
	@updatedby	
	
	@param	string	str
	@param	integer	split_length = 1
	
	@variable	string	returnStringArray
	@variable	 TList	splitStringList
	@variable	integer	numberOfStringSplits
	@variable	integer	currentStringIndex
	@variable	integer	splitStringListLength
	@variable	integer	cnt
	
	@return	string array
End Rem
Function str_split:String[] (str:String, split_length:Int = 1)
	
	Local returnStringArray:String[]
	If (str.Length > 0)
		
		Local splitStringList:TList = New TList
		Local numberOfStringSplits:Int = Int(str.Length / split_length)
		Local currentStringIndex:Int = 0
		Local splitStringListLength:Int = 0
		
		While ( currentStringIndex <= numberOfStringSplits )
			
			If ( ( currentStringIndex * split_length ) + split_length < str.Length )
				splitStringList.AddLast( substr( str, currentStringIndex * split_length, split_length ) )
			Else
				splitStringList.AddLast( str[currentStringIndex*split_length..str.Length] )
			End If
			
			currentStringIndex:+1
			
		Wend
		
		splitStringListLength = splitStringList.Count()
		returnStringArray = New String[splitStringListLength]
		
		For Local cnt:Int = 0 To splitStringListLength - 1
			returnStringArray[cnt] = splitStringList.ValueAtIndex(cnt).ToString()
		Next
		
		Return returnStringArray
		
	EndIf
	
	returnStringArray = [""]
	Return returnStringArray
	
End Function